var morextgg = {
    showReadOnlyWindow: function (xtggdata) {
        xtggdata.xtggReadonly = true;
        morextgg.win = $.window({
            title: "公告详细",
            iconCls: 'icon-add',
            width: 800,
            height: 500,
            cache: false,
            url: $.webPath() + "/base/xtgg/xtgggl_content",
            data: xtggdata,
            buttons: []
        });
    },
    initDataGrid: function () {
        $('#grid_morextgg').datagrid({
            url: $.webPath() + "/base/xtgg/xtgg_list?ggzt=1",
            pagination: true,
            rownumbers: true,
            fitColumns: true,
            singleSelect: true,
            pageNumber: 1,
            fit: true,
            striped: true,
            onDblClickCell: function (index, field) {
                if (field == "ggzt") {
                    var row = $(this).datagrid("getSelected");
                    morextgg.showReadOnlyWindow({"xtgg.id": row.id});
                }
            },


            columns: [
                [
                    {field: 'ggbt', title: '公告标题', width: 50,
                        formatter: function (value) {
                            if (null != value && value.length > 10) {
                                return value.substring(0, 8)+".....";
                            } else{
                                return value
                            }
                        }
                    },
                    {field: 'ggnr', title: '公告内容', width: 150,
                        formatter: function (value) {
                            if (null != value && value.length > 30) {
                                return value.substring(0, 25)+".....";
                            }else{
                                return value
                            }
                        }

                    },
                    {field: 'ggzt', title: '查看信息', width: 40,
                        formatter: function (value) {
                            if (null != value)
                                return '<a href="javascript:void(0);" style="color: #ff0000">双击查看详细</a>';
                        }
                    },
                    {field: 'fbdate', title: '发布时间', width: 60,
                        formatter: function (value) {
                            if (null != value) {
                                return value;
                            }
                        }
                    }
                ]
            ]

        });
    }
}
$(function () {
    //表格初始加载
    morextgg.initDataGrid();
});